$('#loadpub').fadeIn('fast',function(){
	$('public').empty;
	
	var fkey = "34ff39837fe17beaf0502aded9e78a4f";
	var ykey = "bdda85402c863453487c2a7a61a709fd";
	
	var d = new Date();
	var date = d.getDate();
		if (date < 10)
			date = "0"+date;
	var month = d.getMonth()+1;
		if (month < 10)
			month = "0"+month;
	var year = d.getFullYear();
	var lastyear= year - 1;
	
	$.getJSON('http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key='+fkey+'&per_page=500&date='+lastyear+'-'+month+'-'+date+'&format=json&jsoncallback=?',
		function(data){
			var imagearry=data.photos.photo.sort(function(){
				return Math.random()>0.5?-1:1;
			});
			var imagelist=imagearry.slice(1,11);
			$.each(imagelist, function(i,item){
				var url = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '_s.jpg';
				var dest = 'http://www.flickr.com/photos/'+item.owner+'/'+item.id+'/';
				var image = '<a href="'+dest+'" target="_blank"><img src="'+url+'" /></a>';

				$('#flickr').append(image);
				$('#loadpub').fadeOut('fast',function(){
					$('#flickr').fadeIn('fast');
			});
			});
		});
	
	$.getJSON('http://www.yupoo.com/api/rest/?method=yupoo.interestingness.getList&api_key='+ykey+'&per_page=500&format=json&callback=?',
		function(data){
			var imagearry=data.result.photos.sort(function(){
				return Math.random()>0.5?-1:1;
			});
			var imagelist=imagearry.slice(1,11);

			$.each(imagelist, function(i,item){
				var idarrary = item.id.split("-");
				var photoid = idarrary[1];
				var url = 'http://photo' +item.host+ '.yupoo.com/' +item.dir+ '/' +item.filename+ '/square/';
				var dest = 'http://www.yupoo.com/photos/'+item.ownername+'/'+photoid+'/';
				var image = '<a href="'+dest+'" target="_blank"><img src="'+url+'" /></a>';

				$('#yupoo').append(image);
				$('#loadpub').fadeOut('slow',function(){
					$('#yupoo').fadeIn('fast');
			});
			});
		});
	
});
